/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pa165.dominatingspecies.frontend.element;

/**
 *
 * @author Ondrej Prazak
 */
public abstract class EnumKeyProvider {

    /**
     * The current key generation strategy.
     */
    private static EnumKeyProvider provider = new DefaultEnumKeyProvider();

    /**
     * Encapsulates the I18N key generation algorithm (strategy)
     *
     * @param <T> The enum type
     * @param enumValue The enum value
     * @return a String defining the I18N key for the provided enum
     */
    public abstract <T extends Enum<T>> String computeKey(T enumValue);

    /**
     * Static accessor to the I18N key generation algorithm
     */
    public static <T extends Enum<T>> String getKey(T enumValue) {
        return EnumKeyProvider.provider.computeKey(enumValue);
    }

    public static EnumKeyProvider getDefault() {
        return EnumKeyProvider.provider;
    }

    public static void setDefault(EnumKeyProvider provider) {
        EnumKeyProvider.provider = provider;
    }
}
